﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebManageRoles>" %>

<%@ Import Namespace="Common.Background.Entity" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    职位设置
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        <%=Html.ActionLink("职位设置", "WebManageRolesList", "System")%>-<%= Model.ManageRoleID==int.MinValue?"添加职位":"修改职位" %></h1>
    <%=Html.Partial("UCWebManageRoles",Model) %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="../../Scripts/JQTree/jquery.tree.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#chooseall").bind("click", function () {
                if (this.value != "取消") {
                    var li = document.getElementsByName("ManageRolesWebManage");
                    for (var i = 0; i < li.length; i++) {
                        li[i].checked = true;
                    }
                    this.value = "取消";
                    this.innerHTML = "取消"
                } else {
                    this.value = "全选";
                    this.innerHTML = "全选"
                    var li = document.getElementsByName("ManageRolesWebManage");
                    for (var i = 0; i < li.length; i++) {
                        li[i].checked = false;
                    }
                }
            });

            var jstree = $("#MenusTree").tree({ "plugins": ["themes", "html_data", "ui"] });

            $("#MenusTree :checkbox").change(function () { var checked = this.checked; $(this).parent().find(":checkbox").each(function (i, o) { o.checked = checked }); });



            $("form").validate({
                rules: {
                    RoleName: {
                        required: true,
                        minlength: 2,
                        maxlength: 50
                    },
                    DepartmentID: {
                        required: true
                    },
                    About: {
                        required: true,
                        minlength: 2,
                        maxlength: 50
                    },
                    SortNumber: {
                        required: true,
                        number: true
                    },
                    ManageRolesWebManage: {
                        required: true
                    }
                },
                messages: {
                    RoleName: {
                        required: "请输入角色名称",
                        minlength: "角色名称至少为2个字符，最多为50个字符",
                        maxlength: "角色名称至少为2个字符，最多为50个字符"
                    },
                    DepartmentID: {
                        required: "必须选择部门"
                    },
                    About: {
                        required: "请输入职位信息",
                        minlength: "职位信息至少为2个字符，最多为50个字符",
                        maxlength: "职位信息至少为2个字符，最多为50个字符"
                    },
                    SortNumber: {
                        required: "必须输入排序数",
                        number: "排序数必须是数字"
                    },
                    ManageRolesWebManage: {
                        required: "至少选择1项选择菜单"
                    }
                }
            });
        });
    </script>
</asp:Content>
